package frapell.funny.quotes;

import java.util.ArrayList;

public class BashOrgQuotes {


	ArrayList<String> quotes_title = new ArrayList<String>();
	ArrayList<String> quotes_content = new ArrayList<String>();
	
	int current_quote = 0;
	
	private static final BashOrgQuotes sInstance = new BashOrgQuotes();

    private BashOrgQuotes() {
    }
    
    public static BashOrgQuotes getInstance() {
        return sInstance;
    }
    
    public void storeTitle(String quote_number){
    	this.quotes_title.add(quote_number);
    }
    
    public void storeQuote(String quote){
    	this.quotes_content.add(quote);
    }
    
    public void nextQuote(){
    	if (this.current_quote < this.quotes_title.size() -1 &&
    		this.current_quote < this.quotes_content.size() - 1){
    		this.current_quote++;
    	}
    }
	
    public void previousQuote(){
    	if (this.current_quote>0){
    		this.current_quote--;
    	}
    }
    
    public String getCurrentTitle(){
    	String title = "";
    	
    	if (this.hasContent()){
    		title = this.quotes_title.get(this.current_quote);
    	}
    	
    	return title;
    }
    
    public String getCurrentQuote(){
    	String quote = "";
    	
    	if (this.hasContent()){
    		quote = this.quotes_content.get(this.current_quote);
    	}
    	
    	return quote;
    }

    public boolean shouldUpdate(){
    	return ((this.quotes_title.size() - this.current_quote) < 10);
    }
    
    private boolean hasContent(){
    	return (this.quotes_title.size() > 0 && this.quotes_content.size() > 0);
    }
}
